package com.example.cadmin.mapper;

import com.example.cadmin.entity.MyDept;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.cadmin.entityVo.MenuALLVo;
import com.example.cadmin.entityVo.MyDeptTreeVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 部门表 Mapper 接口
 * </p>
 *
 * @author zzsoft
 * @since 2023-02-18
 */
public interface MyDeptMapper extends BaseMapper<MyDept> {

    /**
     * 绘制部门树
     */
    @Select("select d.dept_id as id,d.parent_id,d.dept_name as title from my_dept as d")
    List<MenuALLVo> buildDeptAll();

    /**
     * 绘制部门树(用户管理使用)
     */
    @Select("select d.dept_id as id,d.parent_id as parentId ,d.dept_name as title from my_dept as d")
    List<MyDeptTreeVo> buildDept();

}
